<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal"
	scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

<%@ include file="/WEB-INF/include/meta.jsp"%>
<%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

	<%@ include file="/WEB-INF/include/header.jsp"%>

	<%@ include file="/WEB-INF/include/menu.jsp"%>
	<div class="container-fluid ms-container has-ms-sidemenu">

		<ol class="ms-breadcrumb breadcrumb">
			<li class="active">优惠券&nbsp;&nbsp;-&nbsp;&nbsp;模板详情</li>
			<li class="no-before pull-right" style="min-width: 65px;">
            <a onclick="window.history.back();"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;&nbsp;返回</a>
          </li>
		</ol>

		<div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
			<%@ include file="/WEB-INF/include/submenu.jsp"%>
		</div>

		<div class="ms-content-layout ">
			<div class="form-horizontal ms-form form-personal-info">
				<div class="block-heading">
					<h5>基本信息</h5>
					<c:if test="${currentPrincipal.admin or currentPrincipal.root}">
						<a href="${ctx.host}/coupon-template/${couponTemplate.id}/edit"
							data-target="#coupon-template-edit" data-toggle="modal"
							class="hover-no-text-decoration"
							style="position: absolute; right: 0px; top: 0px; margin-top: 0px; margin-right: 10px;"
							title="编辑信息">编辑信息</a>
						<a
							href="${ctx.host}/coupon-template/${couponTemplate.id}/edit-description"
							data-target="#coupon-template-edit-description"
							data-toggle="modal" class="hover-no-text-decoration"
							style="position: absolute; right: 0px; top: 0px; margin-top: 0px; margin-right: 100px;"
							title="编辑使用规则">编辑使用规则</a>
					</c:if>
				</div>
				<div class="form-group ms-form-group">

					<label class="control-label col-xs-2" style="width: 15%;">优惠券名称：</label>
					<div class="col-xs-2">
						<p class="form-control-static">${couponTemplate.name}</p>
					</div>
					<label class="control-label col-xs-2" style="width: 15%;">折扣类型：</label>
					<div class="col-xs-2">
						<p class="form-control-static">${couponTemplate.discountType.description}</p>
					</div>

				</div>
				<div class="form-group ms-form-group">

					<label class="control-label col-xs-2" style="width: 15%;">面值：</label>
					<div class="col-xs-2">
						<p class="form-control-static"><fmt:formatNumber type="percent" maxFractionDigits="2"  pattern="0.00" value="${couponTemplate.amount/100}" />元</p>
					</div>
					<label class="control-label col-xs-2" style="width: 15%;">最低消费金额：</label>
					<div class="col-xs-2">
						<p class="form-control-static"><fmt:formatNumber type="percent" maxFractionDigits="2"  pattern="0.00" value="${couponTemplate.minAmount/100}" />元</p>
					</div>

				</div>

				<div class="form-group ms-form-group">

					<label class="control-label col-xs-2" style="width: 15%;">创建时间：</label>
					<div class="col-xs-2">
						<p class="form-control-static">
                  <fmt:formatDate value="${couponTemplate.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </p>
					</div>
					<label class="control-label col-xs-2" style="width: 15%;">可转赠：</label>
					<div class="col-xs-2">
						<p class="form-control-static">
                  ${couponTemplate.giveAvailable ? '是' : '否'}
                </p>
					</div>
				</div>

				<div class="form-group ms-form-group">

					<label class="control-label col-xs-2" style="width: 15%;">使用规则：</label>
					<div class="col-xs-2">
						<p class="form-control-static">
                  ${couponTemplate.description}
                </p>
					</div>
				</div>

				<div class="block-heading">
					<h5>统计信息</h5>
				</div>
				<div class="form-group ms-form-group">

					<label class="control-label col-xs-2" style="width: 15%;">生成批次数：</label>
					<div class="col-xs-2">
						<p class="form-control-static">${persist.couponTemplateStat(couponTemplate.id).batchCount}</p>
					</div>
					<label class="control-label col-xs-2" style="width: 15%;">总发放数：</label>
					<div class="col-xs-2">
						<p class="form-control-static">${persist.couponTemplateStat(couponTemplate.id).totalCount}</p>
					</div>
				</div>
				<div class="form-group ms-form-group">

					<label class="control-label col-xs-2" style="width: 15%;">总使用数：</label>
					<div class="col-xs-2">
						<p class="form-control-static">${persist.couponTemplateStat(couponTemplate.id).usedCount}</p>
					</div>
					<label class="control-label col-xs-2" style="width: 15%;">过期数：</label>
					<div class="col-xs-2">
						<p class="form-control-static">${persist.couponTemplateStat(couponTemplate.id).overdueCount}</p>
					</div>
				</div>
				<div class="form-group ms-form-group">

					<label class="control-label col-xs-2" style="width: 15%;">总优惠金额：</label>
					<div class="col-xs-2">
						<p class="form-control-static"><fmt:formatNumber type="percent" maxFractionDigits="2"  pattern="0.00" value="${persist.couponTemplateStat(couponTemplate.id).amount/100} "/>元</p>
					</div>
					<label class="control-label col-xs-2" style="width: 15%;">实际优惠金额：</label>
					<div class="col-xs-2">
						<p class="form-control-static"><fmt:formatNumber type="percent" maxFractionDigits="2"  pattern="0.00" value="${persist.couponTemplateStat(couponTemplate.id).actualAmount/100}" />元</p>
					</div>
				</div>


			</div>
		</div>





	</div>

	<%@ include file="/WEB-INF/include/footer.jsp"%>
	<%@ include file="/WEB-INF/include/script.jsp"%>
	<d:resource root="${ctx.resource}/build" type="script"
		src="js/page/encommerce/coupon/coupon-batch-view.js">
		<script type="text/javascript">
			require([ 'page/encommerce/coupon/coupon-batch-view' ], function(
					page) {
				page.init()
			})
		</script>
	</d:resource>
</body>
</html>